<%-- 
    Document   : verify_visit_other
    Created on : Nov 18, 2013, 6:28:46 PM
    Author     : Mansur
--%>

<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>.: Ship Visit :.</title>    
        <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.blockUI.js"></script>   
        <script type="text/javascript">
            $(function() {
                $("#datepicker2").datepicker({
                    showOn: "button",
                    buttonImage: "${pageContext.request.contextPath}/images/icon/calendar.gif",
                    buttonImageOnly: true,
                    changeMonth: true,
                    dateFormat: 'dd/mm/yy',
                    changeYear: false,
                    maxDate: new Date(),
                    minDate: minDate()
                });
            });
            
            function validateEmpty(){
                var validate = true;
                if($('#vesselId').val() === '' || $('#datepicker2').val() === '' || $('#location').val() === '' || $('#desc').val() === ''){
                    alert('All form fields are required!');
                    validate  = false;
                }
                return validate;
            }
            
            function unblockUI() {
                $.unblockUI();
            }
            
            function blockUI () {
                $.blockUI();
            }
            
            function minDate(){
                var year = ${actionBean.currentYear};
                var date = new Date(year,0,1);
                return date;
            }
            
            function popupWinView(id) {
                var url = '${pageContext.request.contextPath}/shipVisitFlow?viewDoc&idVisit=' + id;
                var left = (screen.width/2)-(1000/2);
                var top = (screen.height/2)-(1000/2);                
                var params = 'width=1000';
                params += ', height=1000';
                params += ', top=' + top;
                params += ', left=' + left;
                //params += ', fullscreen=yes';
                params += ', directories=no';
                params += ', location=no';
                params += ', menubar=no';
                params += ', resizable=no';
                params += ', scrollbars=yes';
                params += ', status=no';
                params += ', toolbar=no';                
                newwin = window.open(url, 'PopUp', params);
                if (window.focus) {
                    newwin.focus();
                }                
                return false;
            }
        </script>
        <style>
            .validateTips { border: 1px solid transparent; padding: 0.3em; color: red; font-weight: bold}
        </style>
    </head>
    <body>
        <s:useActionBean beanclass="exatrez.stripes.util.ListUtil" var="list"/>
        <s:form beanclass="exatrez.stripes.action.ShipVisitFlowAction" name="form1">   
            <s:hidden name="shipVisitFlowId" />
            <s:hidden name="currentYear" />
            <div>
                <fieldset>
                    <div id="page-title">
                        <span class="title">Ship Visit Form</span>
                    </div>
                    <s:messages/>
                    <s:errors/>
                    <!--<p class="validateTips"><em>All form fields are required except Attachment.</em></p>-->
                    <c:if test="${actionBean.staffView}" >
                        <div style="align: left">
                            <s:button name="" value="Back" class="btn" onclick="history.back();"/>
                        </div>
                    </c:if>
                    <c:if test="${actionBean.superiorView}" >
                        <p>
                            <label>Staff ID :</label>
                            ${actionBean.shipVisitFlow.user.userId}&nbsp;
                        </p>
                        <p>
                            <label>Department :</label>
                            ${actionBean.shipVisitFlow.user.department.departmentName}&nbsp;
                        </p>
                    </c:if>
                    <p>
                        <label>Vessel Name :</label>
                        <%--<s:select name="shipVisitFlow.vessel.vesselId" id="vesselId" style="width:200px">
                            <s:option value="">Please Choose</s:option>
                            <s:options-collection collection="${list.vesselList}" label="vesselName" value="vesselId"/>
                        </s:select>--%>
                        ${actionBean.shipVisitFlow.vessel.vesselName}&nbsp;
                    </p>
                    <p>
                        <label>Date Visit :</label>
                        <%--<s:text name="shipVisitFlow.dateVisit" id="datepicker2" formatType="date" formatPattern="dd/MM/yyyy" readonly="true"/>--%>     
                        <fmt:formatDate value="${actionBean.shipVisitFlow.dateVisit}" pattern="dd/MM/yyyy"/>
                    </p>
                    <p>
                        <label>Location :</label>
                        <%--<s:text name="shipVisitFlow.location" id="location" size="55" class="uppercase" />--%>
                        ${actionBean.shipVisitFlow.location}&nbsp;
                    </p>
                    <p>
                        <label style="vertical-align: top">Description :</label>
                        <s:textarea name="shipVisitFlow.description" id="desc" rows="10" cols="50" readonly="true"/>
                    </p>
                    <p>
                        <label>Attachment/s :</label>
                        <s:button name="" value="View" class="btn" onclick="return popupWinView('${actionBean.shipVisitFlow.shipVisitFlowId}');"/>
                    </p>
                </fieldset>
            </div>
            <c:if test="${actionBean.superiorView}" >
                <div>
                    <fieldset>
                        <div id="page-title">
                            <span class="title">Remarks</span>
                        </div>
                        <p>
                            <label>Approval :</label>
                            <s:radio name="status" value="A" />Approve &nbsp; <s:radio name="status" value="R" />Reject
                        </p>
                        <p>
                            <label>Comment :</label>
                            <s:textarea name="rejectNote" id="rejectnote" rows="5" cols="50"/>
                        </p>
                        <p>
                            <label>&nbsp;</label>
                            <s:submit name="staffVisitKIV" value="Back" class="btn" />&nbsp;&nbsp;
                            <s:submit name="submitBack" value="Submit" class="btn" />
                        </p>
                    </fieldset>
                </div>
            </c:if>           
            <c:if test="${actionBean.staffView}" >
                <div style="align: left">
                    <s:button name="" value="Back" class="btn" onclick="history.back();"/>
                </div>
            </c:if>
            <div>
                <fieldset>
                    <div id="page-title">
                        <span class="title">History report</span>
                    </div>
                    <display:table class="tablecloth" name="${actionBean.listHistory}" requestURI="/shipVisitFlow" id="line" style="width:50%">
                        <display:column title="No." ><center>${line_rowNum}.</center></display:column>
                        <display:column title="Status">
                            <c:if test="${line.status eq 'R'}">
                                Rejected
                            </c:if>
                            <c:if test="${line.status eq 'A'}">
                                Approved
                            </c:if>
                        </display:column>
                        <display:column title="Remarks" property="rejectNote" />
                        <display:column title="Date Approval" sortable="true"><fmt:formatDate value="${line.infoAudit.createDate}" pattern="dd/MM/yyyy hh:mm:ss a"/></display:column>
                        <display:column title="Approval By" sortable="true" property="verifierId.userId"/>
                    </display:table>                    
                </fieldset>
            </div>
        </s:form>
    </body>
</html>